﻿CREATE TABLE [dbo].[tblCarrierZonePostalCode]
(
	CarrierZonePostalCodeID int not null identity(1,1) primary key,
	CarrierID int not null,
	LocationID int not null,
	CountryID int not null,
	PostalCodeLow nvarchar(12) null,
	PostalCodeHi nvarchar(12) null,
	Zone varchar(2) not null
)
go;
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Links postal codes and warehouse locations to carrier zones.  Each carrier defines their rates by service and zone and the zones are defined by a starting and ending postal code.', 
	@level0type = N'SCHEMA', @level0name = N'dbo',
	@level1type = N'TABLE', @level1name = N'tblCarrierZonePostalCode';
GO;
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'The CarrierID defines the carrier and service', 
	@level0type = N'SCHEMA', @level0name = N'dbo',
	@level1type = N'TABLE', @level1name = N'tblCarrierZonePostalCode',
	@level2type = N'COLUMN', @level2name = N'CarrierID';
GO;
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'PostalCodeLow and PostalCodeHi define a range of postal codes.  All codes falling in this range fall in the defined zone.  If these are null then one zone applies to the entire country.  A postal code can match multiple CarrierZonePostalCode records in which case the most specific record wins.', 
	@level0type = N'SCHEMA', @level0name = N'dbo',
	@level1type = N'TABLE', @level1name = N'tblCarrierZonePostalCode',
	@level2type = N'COLUMN', @level2name = N'PostalCodeLow';
GO;
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'', 
	@level0type = N'SCHEMA', @level0name = N'dbo',
	@level1type = N'TABLE', @level1name = N'tblCarrierZonePostalCode',
	@level2type = N'COLUMN', @level2name = N'PostalCodeHi';
GO;
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'The location ID of the warehouse the zones are defined for.', 
	@level0type = N'SCHEMA', @level0name = N'dbo',
	@level1type = N'TABLE', @level1name = N'tblCarrierZonePostalCode',
	@level2type = N'COLUMN', @level2name = N'LocationID';
GO;
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'The zone definition.  Combined with the CarrierID links to the CarrierZoneRate table.', 
	@level0type = N'SCHEMA', @level0name = N'dbo',
	@level1type = N'TABLE', @level1name = N'tblCarrierZonePostalCode',
	@level2type = N'COLUMN', @level2name = N'Zone';
GO;
